const jwt = require('jsonwebtoken');
const key = 'shared-secret';

const setToken = (data) => {
  return jwt.sign(data, key, { expiresIn: '1h'})
}

const checkToken = (token) => {
  return  token && jwt.verify(token, key);
}

module.exports = {
  setToken,
  checkToken
};